File Editor
The file editor is a tool used to manage all files used in the MAO project. You can access the file editor by logging into backoffice. More information here. The file editor can be found at this web address https://backoffice.abair.ie/files.
Usage
Namespaces
Upon entering the file editor page you will be welcomed with a similar screen.

At the time of writing this documentation the file editor is only used by the stories engine. In the future this page will have a folder for any other sub application in MAO that uses assets from supabase. In the story editor these sub applications are referred to as "namespaces".
You can press the Open in files button to view more information on the files within that namespace.
Locations

Upon opening the folder you will be presented with every location where files from supabase storage are being used. In this example the stories namespace had files being used by stories with ID's 1, 3 and 53.
Note that there is an extra folder at the bottom called "unused". Files can end up in the unused folder in two cases.
-
The user removes the reference to the file from the location (story, in this case) in which the file was being used.
-
The user adds multiple files at once using the "Upload multiple files at once" feature and hasn't linked them to anything yet. You can see this feature in the above screenshot.
To view the files within a location press the Open in files button in the row of the location of which files you wish to access.
Files

-
In this view you can see the name and ID of each file.
-
You can also navigate the file editor by pressing the blue button that will lead you to the location in file editor at which that file is also used.
-
You can view the file in a new tab by pressing the
View filebutton. -
Finally, you can remove each file individually or remove them all at once by pressing the
DELETE ALLbutton above of the file list. If the file you are deleting is used by another location it will not delete the actual file, instead it will just unlink it from the source location. In this case story with ID1. -
In the case of the stories files, when a file is removed using the file manager it will unlink all the files from the story entry you are deleting the files from.
Architecture
Files are stored in supabase storage. The information about the location of the file within the app is stored within the file_system table.
file_system
| column | type | description |
|---|---|---|
id | number | The ID of that file_system entry. Has nothing to do with the file itself. It is automatically generated and used only internally. |
name | string | The name of the file as it was uploaded and as it exists in supabase cloud storage. |
file_id | uuid | The ID of the file whose location information the entry contains. |
type | string | Eg. "audio", "image", "video" |
namespace | string | The namespace in which the file is used. Eg. "stories" |
location | array of strings | Stores locations in which the file is used within a given namespace. |